package spring_ioc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import spring_ioc.service.Impl.UserServiceImplBefore;
import spring_ioc.service.Impl.UserServiceImplNow;

public class Main {
    public static void main(String[] args) {
        //传统的方式
        UserServiceImplBefore userServiceImplBefore = new UserServiceImplBefore();
        userServiceImplBefore.getUserById();

        //改进后的方式
        ApplicationContext context = new ClassPathXmlApplicationContext("application.xml");
        UserServiceImplNow userServiceImplNow = context.getBean(UserServiceImplNow.class);
        userServiceImplNow.getUserById();
    }
}
